package model

import (
	"github.com/jinzhu/gorm"
	"time"
)

type Message struct {
	Id int64 `xorm:"pk autoincr"`
	Type int
	JobSeekersId int64
	JobSeekersName string
	CompanyId int64
	CompanyName string `gorm:"index"`
	Content string
	CreatedAt time.Time
	UpdatedAt time.Time
}

//func (message *Message)InsertMessage(m *Message, session *xorm.Session) error {
//
//	_, err := session.Insert(m)
//	if err != nil{
//		return err
//	}
//
//	return nil
//}

func (message *Message)InsertMessage(m *Message, tx *gorm.DB) error {

	err := tx.Create(m).Error
	if err != nil{
		return err
	}

	return nil
}
